#include "connectmng.h"

ConnectMng::ConnectMng(QObject *parent) : QObject(parent)
{

}

QMap<QString, DBConnection> ConnectMng::getDBConnMap()
{
    return m_connMap;
}

void ConnectMng::createConnection(DBConnection conn)
{
    m_connMap.insert(conn.getName(), conn);
    emit connCreated(conn);
}

void ConnectMng::deleteConnection(QString name)
{
    m_connMap.remove(name);
    emit connDeleted(name);
}

void ConnectMng::editConnection(DBConnection conn)
{
    QString name = conn.getName();
    m_connMap.insert(name, conn);
    emit connEditted(conn);
}

bool ConnectMng::isSupported(int type)
{
    bool isSupporte = true;
    if(POSTGRESQL == type || REDIS == type) {
        isSupporte = false;
    }

    return isSupporte;
}
